package day_06;

/**
 * @ClassName ArraysTools
 * @Description TODO
 * @Author hp
 * @Date 2021/6/8 10:22
 * @Version 1.0
 **/
public class ArraysTools {
    public static int[] sort(int[] x) {
        for (int i = 0; i < x.length - 1; i++) {
            for (int j = 0; j < x.length - 1; j++) {
                if (x[j] > x[j + 1]) {
                    x[j] = x[j] ^ x[j + 1];
                    x[j + 1] = x[j + 1] ^ x[j];
                    x[j] = x[j + 1] ^ x[j];
                }
            }
        }
        return x;
    }

    public static String toString(int[] x) {
        String str = "[";
        for (int i = 0; i < x.length; i++) {
            if (i != x.length - 1) {
                str += x[i] + ",";
            } else {
                str += x[i] + "]";
            }
        }
        return str;
    }
}
